/// <reference path="./styles.d.ts" />

const m = 0, s = 0, e = 0, r = false, i = false, mx = 0, my = 0, mz = 0, b = 0, t = 0, trans = [], color = "#eee"


/** 重复利用的预设样式 */
export const styles: params.styles = {
  preset: {
    '新中式坡屋顶<高度,出挑><颜色,屋顶颜色>': {
      unit: { 高度: 2, 出挑: 0.5 },
      color: { 颜色: '#863', 屋顶颜色: '#666' },
      floor: [
        {
          slopingRoof: [{ height: '1高度-0.3', color: '屋顶颜色', trans: [{ mx, my, mz: 0.3 }] }]
        },
        {
          setEdges: [{ scale: '-1出挑' }],
          extrude: [{ height: 0.2, color: '颜色', trans: [{ mx, my, mz: 0.1 }] }]
        },
        {
          setEdges: [{ scale: '0.1-1出挑' }],
          extrude: [{ height: 0.1 }]
        }
      ],
    },
    '新中式段顶线脚<总高,标高><颜色>': {
      unit: { 总高: 0.6, 标高: '1BH-2.6' },
      color: { 颜色: '#eee' },
      floor: [
        {
          setEdges: [{ scale: -0.2 }],
          extrude: [
            {
              once: true, height: 0.1, color: '颜色',
              trans: [{ mx, my, mz: '1标高+1总高-0.1' }]
            },
            {
              once: true, height: 0.1, color: '颜色',
              trans: [{ mx, my, mz: '1标高' }]
            }
          ],
        },
        {
          extrude: [{
            once: true, height: '1总高-0.2', color: '颜色',
            trans: [{ mx, my, mz: '1标高+0.1' }]
          },],
          facade: [
            {
              once: true,
              proto: [{
                spacing: [{
                  group: [{
                    x: 0.2, y: 0.2, z: '1总高-0.2',
                    color: '颜色', trans: [{ mx, my, mz: '1标高+0.1' }],
                  }],
                  space: 0.6
                }]
              }],
            }
          ]
        },
      ]
    },
    '竖向划分入户门<总高,标高><颜色>': {
      unit: { 总高: '1SH', 标高: 0.45 },
      color: { 颜色: '#541' },
      floor: [
        {
          facade: [{
            once: true,
            proto: [
              // 门上饰面，填充剩余段高
              {
                spacing: [
                  {
                    space: 0.3,
                    group: [
                      {
                        x: 0.1, y: 0.4, z: '1SH-1标高-2.6',
                        color: '颜色', trans: [{ mx, my, mz: '1标高+2.6' }]
                      }
                    ],
                  }
                ],
                first: false
              },
              // 门上横隔断
              {
                spacing: [
                  { space: 0.1 },
                  {
                    space: 1.4,
                    group: [
                      {
                        depth: -0.5, height: 0.2,
                        color: '颜色', trans: [{ mx, my, mz: '1标高+2.4' }]
                      }
                    ]
                  }
                ],
                last: true
              },
              {
                spacing: [
                  { space: 0.1, group: [{ x: 0.2, y: 0.8, z: '1总高', color: '颜色', trans }] },
                  {
                    space: 0.7, group: [
                      {
                        depth: -0.2, height: 2.4, color: '颜色',
                        trans: [{ mx, my, mz: '1标高' }]
                      },
                    ]
                  },
                  {
                    space: 0.7, group: [
                      {
                        depth: -0.2, height: 2.4, color: '颜色',
                        trans: [{ x, y, z: '1标高' }]
                      },
                      // 该处为正中心，生成门把手
                      {
                        x: 0.1, y: 0.5, z: 0.6, color,
                        trans: [{ x: -0.2, y, z: '1标高+0.6' }]
                      },
                      {
                        x: 0.1, y: 0.5, z: 0.6, color,
                        trans: [{ x: 0.2, y, z: '1标高+0.6' }]
                      }
                    ]
                  },
                ],
                last: true
              },
            ],
          }
          ]
        }
      ]
    },
    '横向门搭配竖向划分入户门<><颜色>': {
      color: { 颜色: '#541' },
      floor: [
        {
          facade: [{
            proto: [{
              divide: [{
                group: [
                  { depth: 0.3, height: 2.2, color: '颜色', trans },
                  {
                    depth: 0.6, height: 0.2, extend: 0.6,
                    color: '颜色', trans: [{ x: -0.3, y, z: 2.2 }]
                  }
                ],
                count: 1
              }],
            }]
          }]
        }
      ]
    },
    '竖向划分立面窗<总高><浅色,深色>': {
      unit: { 总高: '1SH' },
      color: { 浅色: '#863', 深色: '#541' },
      floor: [
        {
          facade: [{
            once: true,
            proto: [{
              spacing: [
                { space: 1, group: [{ depth: -0.2, height: '1总高' }] },
                { space: 0.1, group: [{ x: 0.1, y: 0.3, z: '1总高', color: '浅色', trans }] },
                { space: 0.6, group: [{ x: 0.1, y: 0.1, z: '1总高', color: '深色', trans }] },
                { space: 1.2, group: [{ x: 0.1, y: 0.1, z: '1总高', color: '深色', trans }] },
                { space: 0.6, group: [{ x: 0.1, y: 0.1, z: '1总高', color: '深色', trans }] },
                { space: 0.1, group: [{ x: 0.1, y: 0.1, z: '1总高', color: '深色', trans }] },
                { space: 0.1, group: [{ x: 0.1, y: 0.3, z: '1总高', color: '浅色', trans }] },
              ],
              last: true
            }],
          }
          ]
        }
      ]
    },
    '横向划分立面窗<><浅色,深色>': {
      color: { 浅色: '#863', 深色: '#541' },
      floor: [
        {
          facade: [{
            proto: [{
              spacing: [
                { space: 1 }, { space: 0.1 },
                {
                  space: 2.4, group: [
                    {
                      depth: -0.1, height: 0.05, color: '深色',
                      trans: [{ x, y, z: 2.2 }]
                    },
                    {
                      depth: -0.2, height: 1.2, color: '浅色',
                      trans: [{ x, y, z: -0.4 }]
                    }
                  ]
                },
                { space: 0.2 },
              ],
              last: true
            }]
          }]
        }
      ]
    },
    '新中式角柱<柱高><颜色>': {
      unit: { 柱高: '1BH-4' },
      color: { 颜色: '#541' },
      floor: [
        {
          facade: [{
            once: true,
            proto: [{
              divide: [{
                group: [
                  { x: 0.7, y: 0.7, z: -0.6, color: '颜色', trans: [{ x, y, z: '1柱高' }] },
                  { x: 0.6, y: 0.6, z: '1柱高-0.6', color, trans },
                  { x: 0.7, y: 0.7, z: 1, color: '颜色', trans }
                ],
                count: 1
              }]
            }]
          }]
        }
      ]
    },
    '新中式门廊柱<柱高><颜色>': {
      unit: { 柱高: '1BH-2.6' },
      color: { 颜色: '#541' },
      floor: [
        {
          facade: [{
            once: true,
            proto: [{
              last: true,
              divide: [{
                group: [
                  {
                    x: 0.3, y: 0.7, z: 0.3, color: '颜色',
                    trans: [{ x, y, z: '1柱高-0.4' }]
                  },
                  { x: 0.6, y: 0.6, z: '1柱高' },
                  { x: 0.7, y: 0.7, z: 1, color: '颜色' },
                  // 灯
                  {
                    x: 0.1, y: 0.7, z: 0.1, color: '颜色',
                    trans: [{ x, y, z: 2.4 }]
                  },
                  {
                    x: 0.1, y: 0.7, z: 0.9,
                    trans: [{ x, y, z: 1.5 }]
                  },
                  {
                    x: 0.1, y: 0.7, z: 0.1, color: '颜色',
                    trans: [{ x, y, z: 1.4 }]
                  },
                ],
                count: 1
              }]
            }]
          }]
        }
      ]
    },
    '新中式门廊三级台阶<进深>': {
      unit: { 进深: 4 },
      floor: [
        {
          facade: [{
            once: true,
            proto: [{
              divide: [{
                group: [{
                  depth: '1进深+0.6', height: 0.15, extend: 1.2,
                  trans: [{ x: -0.6, y: -1.6, z }]
                }],
                count: 1
              },
              {
                group: [{
                  depth: '1进深+0.3', height: 0.15, extend: 0.6,
                  trans: [{ x: -0.3, y: -1.3, z: 0.15 }]
                }],
                count: 1
              },
              {
                group: [{
                  depth: '1进深', height: 0.15,
                  trans: [{ x, y: -1, z: 0.3 }]
                }],
                count: 1
              }]
            }]
          }]
        }
      ]
    },
    '新中式门廊阳台<进深,出挑,板厚><颜色>': {
      unit: { 进深: 2, 出挑: 0.5, 板厚: 0.4 },
      color: { 颜色: '#863' },
      floor: [
        {
          setEdges: [
            { scale: -2.5 },
            { clamp: { xCentral: 5, notRatio: true } }
          ],
          facade: [{
            proto: [

              {
                last: true,
                divide: [
                  // 侧面围栏
                  {
                    group: [{
                      x: 0.02, y: '1进深', z: 1, color: '#bbb G',
                      trans: [{ x, y: '0.5进深', z }]
                    }],
                    count: 1
                  }
                ]
              },
              {
                divide: [
                  // 外廊天花
                  // {
                  //   group: [{
                  //     depth: '1进深+0.5出挑', height: 0.2,
                  //     trans: [{ moveX: '-0.5出挑', moveY: '-0.5出挑', moveZ: '1FH-0.5' }]
                  //   }],
                  //   count: 1
                  // },
                  // 正面围栏
                  {
                    group: [{ depth: 0.02, height: 1, color: '#bbb G' }],
                    count: 1
                  },
                  // 楼板
                  {
                    group: [{
                      depth: '1进深+1出挑', height: '1板厚/7*2', extend: '2出挑', color: '颜色',
                      trans: [{ x: '-1出挑', y: '-1出挑', z }]
                    }],
                    count: 1
                  },
                  {
                    group
                      : [{
                        depth: '1进深+1出挑', height: '-1板厚/7*4', extend: '2出挑-0.2', color: '颜色',
                        trans: [{ x: '0.1-1出挑', y: '0.1-1出挑', z }]
                      }],
                    count: 1
                  },
                  {
                    group: [{
                      depth: '1进深+1出挑', height: '1板厚/7', extend: '2出挑', color: '颜色',
                      trans: [{ x: '-1出挑', y: '-1出挑', z: '-1板厚/7*5' }]
                    }],
                    count: 1
                  }
                ]
              }]
          }]
        }
      ]
    },
    '马赛公寓撞色立面阳台<出挑><颜色A,颜色B,颜色C>': {
      unit: { 出挑: 2 },
      color: { 颜色A: '#F44336', 颜色B: '#388E3C', 颜色C: '#FFC107', },
      floor: [
        // 各层元素
        {
          // 出挑地板
          facade: [{
            proto: [
              {
                divide: [
                  {
                    group: [{
                      depth: 0.2, height: 0.4,
                      trans: [{ x, y: '-1出挑', z: 1 }]
                    }],
                    count: 1
                  },
                  {
                    group: [{
                      depth: 0.2, height: 1, color: '#bbb',
                      trans: [{ x, y: '0.2-1出挑', z }]
                    }],
                    count: 1
                  },
                  {
                    group: [{ depth: '-1出挑', height: -0.4 }],
                    count: 1
                  }
                ]
              },
              {
                spacing: [{
                  space: 4,
                  group: [{
                    x: 0.4, y: '2出挑-0.6', z: '1FH', color: ['颜色A', '颜色B', '颜色C']
                  }],
                  control: { chance: 0.4 }
                }],
                first: false
              }
            ]
          }]
        },
        // 通高元素
        {
          facade: [{
            once: true,
            proto: [
              //补齐顶部出挑
              {
                divide: [{
                  group: [{
                    depth: '-1出挑', height: -0.4,
                    trans: [{ x, y, z: '1SH' }]
                  }],
                  count: 1
                }]
              },
              // 竖向通高隔板
              {
                last: true,
                spacing: [{
                  group: [{
                    x: 0.2, y: '2出挑+0.2', z: '1SH',
                    trans: [{ x, y, z: -0.2 }]
                  }],
                  space: 4
                }]
              }
            ]
          }]
        },
      ]
    },
    '马赛公寓通高格栅': { floor: [{}] },
    '马赛公寓中段方窗<墙高,柱宽,间距><墙颜色>': {
      unit: { 墙高: '1FH-1.6', 柱宽: 0.6, 间距: 2 },
      color: { 墙颜色: '#fff' },
      floor: [
        {
          facade: [
            {
              once: true,
              padding: { s: '0.5柱宽', e: '0.5柱宽', m, r },
              proto: [
                {
                  last: true,
                  spacing: [{
                    group: [{ x: '1柱宽', y: 0.5, z: '1SH' }],
                    space: '1间距'
                  }],
                }
              ],
            },
            {
              proto: [{
                divide: [{
                  group: [{ depth: -0.2, height: '1墙高', color: '墙颜色' }],
                  count: 1
                }]
              }]
            }
          ],
        }
      ]
    },
    '马赛公寓屋顶通风塔<数量>': {
      unit: { 数量: 2 },
      floor: [{
        adjunct: [{
          once: true,
          count: '1数量',
          proto: [
            { x: 2, y: 2, z: 10, trans: [{ rx: 5 }] },
            { x: 2, y: 2, z: 10, trans: [{ rx: 5 }, { rz: 120 }] },
            { x: 2, y: 2, z: 10, trans: [{ rx: 5 }, { rz: 240 }] },
            { x: 0.2, y: 1.8, z: 10.5, trans: [{ rx: 5 }] },
            { x: 0.2, y: 1.8, z: 10.5, trans: [{ rx: 5 }, { rz: 120 }] },
            { x: 0.2, y: 1.8, z: 10.5, trans: [{ rx: 5 }, { rz: 240 }] },
            { x: 2, y: 2, z: 0.2, trans: [{ x, y: -1, z: 10.5 }] },
            { x: 2, y: 2, z: 0.2, trans: [{ x, y: -1, z: 10.5 }, { rz: 120 }] },
            { x: 2, y: 2, z: 0.2, trans: [{ x, y: -1, z: 10.5 }, { rz: 240 }] },
          ],
        }]
      }]
    },
  },

  building: {
    'Marseille': {
      type: 'FREE',
      section: {
        roof: {
          height: 2,
          floor: [
            {
              extrude: [
                { height: 1.5, thickness: 0.4 },
                { height: 0.4 }
              ],
            },
            {
              setFloors: { count: 1 },
              setEdges: [{ offset: 4 }],
              preset: [{ name: '马赛公寓屋顶通风塔<数量>' }],
              boxInside: [{
                proto: [{ depth: 2, height: 3, color: '#bbb' }],
                count: 6,
                random: {
                  width: { step: 2, min: 6, max: 15 },
                  depth: { step: 2, min: 3, max: 6 },
                  height: { step: 1, min: 3, max: 5 }
                }
              }]
            }
          ],
        },
        middle: {
          floor: [
            // 楼板
            {
              setEdges: [{ scale: -0.4 }],
              extrude: [{ height: -0.6 }],
            },
            // 整段玻璃
            {
              extrude: [{ once: true, height: '1SH', color: '#666 G' }],
            },
            {
              setEdges: [{ clamp: { xMax: 0.5 } }],
              setFloors: { range: [{ b: 0.35, t: 0.5, r, i }] },
              facade: [{
                proto: [{
                  spacing: [{
                    group: [{ x: 0.2, y: 1, z: '1SH' }],
                    space: 1
                  }]
                }]
              }]
            },
            {
              setEdges: [{ clamp: { xMax: 0.5 } }],
              setFloors: {
                range: [
                  { b: 0.35, t, r, i: true },
                  { b, t: 0.5, r, i: true }
                ]
              },
              preset: [{ name: '马赛公寓撞色立面阳台<出挑><颜色A,颜色B,颜色C>' }]
            },
            {
              setEdges: [{ clamp: { xMin: 0.6, xMax: 0.1 } }],
              preset: [{ name: '马赛公寓撞色立面阳台<出挑><颜色A,颜色B,颜色C>' }]
            },
            {
              setEdges: [{ clamp: { xMin: 0.9 } }, { orient: 'DEPTH' }],
              preset: [{ name: '马赛公寓撞色立面阳台<出挑><颜色A,颜色B,颜色C>' }]
            },
            {
              // 中部方窗
              setEdges: [{ clamp: { xMin: 0.5, xMax: 0.4 } }],
              preset: [{ name: '马赛公寓中段方窗<墙高,柱宽,间距><墙颜色>' }]
            },
            {
              // 阳台端部板墙
              setEdges: [
                { clamp: { xMin: 0.9 } },
                { orient: 'WIDTH' }],
              facade: [
                {
                  once: true,
                  proto: [{
                    divide: [{
                      group: [{ depth: -0.3, height: '1SH' }],
                      count: 1

                    }]
                  }]
                }
              ]
            }
          ],
        },
        bottom: {
          height: 8,
          floor: [
            {
              facade: [{
                once: true,
                proto: [{
                  divide: [{
                    group: [{
                      depth: 4, height: 2, extend: -7,
                      trans: [{ rx: -20 }, { x: 3.5, y, z: '1SH-1' }]
                    }],
                    count: 1
                  }]
                }]
              }]
            },
            {
              setEdges: [
                { offset: 4 },
                { orient: 'WIDTH' }
              ],
              // 架空层斜柱
              facade: [{
                once: true,
                proto: [{
                  last: true,
                  spacing: [{
                    group: [
                      { x: 2, y: 4, z: '1SH', trans: [{ rx: 10 }] },
                      { x: 2, y: 4, z: '1SH', trans: [{ rx: -10 }, { x: 0.2, y, z }] }
                    ],
                    space: 8
                  }],
                }]
              }],
            }, {
              setEdges: [
                { offset: 3 },
                { clamp: { xMin: 0.5, xMax: 0.45 } }
              ],
              // 中部通高贯穿体块
              clampBox: [{ once: true, height: '1BH+12' }]
            }
          ],
        },
      },
    },
    '乡村别墅': {
      type: 'FREE',
      section: {
        roof: {
          height: 2,
          floor: [{
            preset: [
              { name: '新中式坡屋顶<高度,出挑><颜色,屋顶颜色>' }
            ]
          }]
        },
        middle: {
          floor: [
            {
              setEdges: [{
                clamp: { xCentral: 1.2, notRatio: true }
              }],
              preset: [
                { name: '横向门搭配竖向划分入户门<><颜色>' },
              ],
            },
            {
              setEdges: [{
                clamp: { xCentral: 2, notRatio: true, reverse: true }
              }],
              preset: [
                { name: '横向划分立面窗<><浅色,深色>' },
              ],
            },
            {
              setEdges: [
                { scale: -2 },
                { clamp: { xCentral: 3, notRatio: true } }
              ],
              preset: [
                { name: '新中式门廊阳台<进深,出挑,板厚><颜色>' },
              ],
            }
          ]
        },
        bottom: {
          height: 3,
          floor: [
            {
              setEdges: [{
                clamp: { xCentral: 2, notRatio: true }
              }],
              preset: [
                {
                  unit: { 总高: '1BH-2.6' },
                  name: '竖向划分入户门<总高,标高><颜色>',
                },
              ]
            },
            {
              setEdges: [{
                clamp: { xCentral: 2, notRatio: true, reverse: true }
              }],
              preset: [
                {
                  color: { 浅色: '#541' },
                  name: '横向划分立面窗<><浅色,深色>',
                },
                {
                  unit: { 总高: '1BH-2.6' },
                  name: '竖向划分立面窗<总高><浅色,深色>'
                },
              ]
            },
            {
              preset: [
                { name: '新中式段顶线脚<总高,标高><颜色>' },
                { name: '新中式角柱<柱高><颜色>' }
              ],
              extrude: [
                {
                  once: true,
                  height: '1BH-2', color: '#666 G'
                }
              ],
            },
            {
              setEdges: [
                { scale: -2 },
                { clamp: { xCentral: 3, notRatio: true } }
              ],
              preset: [
                { name: '新中式门廊柱<柱高><颜色>' },
                { name: '新中式门廊三级台阶<进深>' }
              ],
              facade: [{
                once: true,
                proto: [
                  {
                    // 外廊顶部线脚饰块
                    spacing: [{
                      group: [{
                        x: 0.2, y: 0.2, z: 0.4,
                        trans: [{ x, y: -0.4, z: '1BH-2.5' }],
                      }],
                      space: 0.6
                    }],
                    last: true,
                  },
                  {
                    // 外廊顶部线脚
                    divide: [{
                      group: [
                        {
                          depth: 3, height: 0.2, extend: 2, color: '#863',
                          trans: [{ x: -1, y: -1, z: '1BH-1.9' }]
                        },
                        {
                          depth: 3, height: 0.2, extend: 1.8,
                          trans: [{ x: -0.9, y: -0.9, z: '1BH-2' }]
                        },
                        {
                          depth: 3, height: 0.1, extend: 1,
                          trans: [{ x: -0.5, y: -0.5, z: '1BH-2.1' }]
                        },
                        {
                          depth: 3, height: 0.4, extend: 0.8,
                          trans: [{ x: -0.4, y: -0.4, z: '1BH-2.5' }]
                        },
                        {
                          depth: 3, height: 0.1, extend: 1,
                          trans: [{ x: -0.5, y: -0.5, z: '1BH-2.6' }]
                        }],
                      count: 1
                    }]
                  }]
              }]
            }
          ]
        }
      }
    }
  }
}
